//
//  RHPolicyModeCell.m
//  RuiHeAppApp
//
//  Created by Yan Chen on 2024/3/12.
//

#import "RHPolicyModeCell.h"
@interface RHPolicyModeCell()
@property (nonatomic ,strong) QMUILabel *contentLab;

@property (nonatomic ,strong) QMUILabel *tipsLab;
@end

@implementation RHPolicyModeCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if(self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]){
        [self setupUI];
    }
    return self;
}

-(void)setMode:(RHPolicyModeModel *)mode
{
    _mode = mode;
    self.contentLab.text = mode.modeName.rh_localized;
    self.tipsLab.text = mode.comment.rh_localized;
}

-(void)setupUI
{
    self.contentView.backgroundColor = CFTabViewBgColor;
    UIView *bgView = kView;
    bgView.backgroundColor = UIColor.whiteColor;
    bgView.layer.cornerRadius = 8;
    bgView.layer.masksToBounds = YES;
    [self.contentView addSubview:bgView];
    [bgView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_offset(15);
        make.right.mas_offset(-15);
        make.top.mas_offset(10);
        make.height.offset(kScaleW(48));
    }];
    
    QMUILabel *titleLab = [[QMUILabel alloc]init];
    titleLab.text = [NSString stringWithFormat:@"%@:",@"模式".rh_localized];
    titleLab.textColor = [UIColor colorWithHexString:@"3F4443" alpha:0.8];
    titleLab.font = kSYSTEMFONT(14);
    [bgView addSubview:titleLab];
    [titleLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_offset(15);
        make.centerY.mas_offset(0);
    }];
    
    UIImageView *indicator = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"kwt_home_arrow"]];
    [bgView addSubview:indicator];
    [indicator mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_offset(-15);
        make.width.height.offset(15);
        make.centerY.mas_offset(0);
    }];
    
    QMUILabel *contentLab = [[QMUILabel alloc]init];
    contentLab.textColor = [UIColor colorWithHexString:@"3F4443" alpha:0.6];
    contentLab.font = kSYSTEMFONT(13);
    contentLab.text = @"无能量调度模式".rh_localized;
    [bgView addSubview:contentLab];
    self.contentLab = contentLab;
    [contentLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(indicator.mas_left).offset(-10);
        make.centerY.mas_offset(0);
    }];
    
    QMUILabel *tipsLab = [[QMUILabel alloc]init];
    tipsLab.textColor = [UIColor colorWithHexString:@"3F4443" alpha:0.6];
    tipsLab.numberOfLines = 0;
    tipsLab.font = kSYSTEMFONT(13);
    [self.contentView addSubview:tipsLab];
    self.tipsLab = tipsLab;
    [tipsLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.equalTo(bgView);
        make.top.equalTo(bgView.mas_bottom).offset(10);
        make.bottom.mas_offset(-10);
    }];
}



@end
